package com.glasses.primework;


import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;

@ManagedBean
public class CarBean {
    private List<Car> cars;
    private Car selectedCar;
    
    public List<Car> getCars() {
        return cars;
    }
    
    public Car getSelectedCar() {
        return selectedCar;
    }
    
    public void setSelectedCar(Car selectedCar) {
        this.selectedCar = selectedCar;
    }
    
    public CarBean() {
        System.out.println("CarBean.CarBean() triggered!!!");
        cars = new ArrayList<>();
        cars.add(new Car(1, "C5", 2002, "Citroen", "red"));
        cars.add(new Car(2, "i8", 2014, "BMW", "black"));
        cars.add(new Car(3, "S600", 2014, "Mercedes", "silver"));
        cars.add(new Car(4, "Windstar", 2000, "Ford", "green"));
        cars.add(new Car(5, "Ram", 2009, "Dodge", "black"));
        cars.add(new Car(6, "Corsa", 2002, "Opel", "red"));
        cars.add(new Car(7, "Bluebird", 1982, "Nissan", "red"));
    }
}
